-- 需要将libmysql.dll放在根目录 和 clibs/luasql
-- package.path="clibs"..";..\?.lua"..";..\?.lua"
local json =require("cjson")
require("config")
conn=getConnect()
if conn == nil then
    print("connect faild...");
    -- os.exit();
    response={
        body='{"code":100000,"msg":"系统异常"}',
        header={}
    }
    response.header["Content-Type"]="application-json;charset=utf-8"
    return 
end
if num==nil then
    num=1
end
num =num +1
print(num)
--查询
local rs,d=conn:execute("select * from short_url order by id desc limit 1")
local row = rs:fetch({},"a");
local list={}
local i=1
while row do
    item={
        id=row.id,
        batch=row.batch,
        row=row.remark
    }
    list[i]=item
    row = rs:fetch(row,"a");
    i=i+1
end
rs:close()
-- conn:close()
result={
    code=0,
    msg="OK",
    list=list
}
js=json.encode(result)
response={
    body=js,
    header={}
}
response.header["Content-Type"]="application-json;charset=utf-8"




